﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;


namespace Notepad_Tremens
{
    public partial class changeinterval : Form
    {
        public string bpath;
        public changeinterval(string backupPath)
        {
            InitializeComponent();
            bpath = backupPath;
            if (!File.Exists(backupPath + "\\BackupInterval.ini"))
            {
                try
                {
                    File.WriteAllText((backupPath + "\\BackupInterval.ini"), "10000");
                }
                catch { MessageBox.Show("Error creating ini file"); }
            }
            else
            {
                try
                {
                    setBackupInterval.Value = int.Parse(File.ReadAllText(backupPath + "\\BackupInterval.ini"));
                }
                catch (Exception e) { MessageBox.Show("Error loading ini file"+e.ToString()); }
            }
            //timer.Interval = backupinterval;
        }

        private void acceptBtn_Click(object sender, EventArgs e)
        {
            try
            {
                File.WriteAllText((bpath + "\\BackupInterval.ini"), setBackupInterval.Value.ToString());
            }
            catch { MessageBox.Show("Error creating ini file"); }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        private void saveNewInterval(int interval)
        {
        }
    }
}
